/*
 * Copyright 2020 The Kubernetes Authors
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

@import '../components/Terminal/mixins';

@mixin LightweightUI {
  html.kui > body.kui--lightweight-ui {
    @content;
  }
}

@mixin NoPadding {
  padding: 0;
  border: none;
  background-color: transparent;
}

@mixin LightweightBlocks {
  @include BlockDuration {
    opacity: 1;
  }

  @include FinishedBlock {
    @include InputWrapper {
      &:before {
        content: '';
        left: -1em;
        top: -$block-padding;
        bottom: -$block-padding;
        width: 4px;
        position: absolute;
        opacity: 0.625;
        background-color: var(--color-table-border2);
      }
    }

    &.error {
      @include InputWrapper {
        &:before {
          opacity: 1;
          background-color: var(--color-red);
        }
      }
    }

    /** when not focus or hover the finished block, only show the input border */
    &:not(:focus):not(:hover) {
      &:before {
        background-color: transparent;
      }
    }

    /** when focus or hover the block, show the original block border */
    &:focus,
    &:hover {
      @include InputWrapper {
        &:before {
          display: none;
        }
      }
    }
  }

  @include Block {
    padding: $block-padding 0;
  }

  @include BlockOutput {
    margin-top: $block-padding;
  }

  @include ActiveBlock {
    padding: $block-padding 0;
    &:first-child {
      margin: 0;
    }
  }
  @include ProcessingBlock {
    padding: $block-padding 0;
    &:first-child {
      margin: 0;
    }
  }

  @include BlockTimestamp {
    color: var(--color-base0A);

    .sub-text {
      color: inherit;
      opacity: 0.85;
    }
  }

  @include BlockInput {
    @include BlockActions {
      top: -3px;
      bottom: -3px;
    }
  }
}
